package com.ship.contract.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ship.contract.bean.ConResourceMain;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author tangshixuan
 * @date 2023-8-31
 */
public interface ConResourceMainMapper extends BaseMapper<ConResourceMain> {

    /**
     * 根据id查询所有信息
     */
    @Select("SELECT * FROM con_resource_main WHERE id = #{id}")
    ConResourceMain getById(@Param("id") Long id);

    /**
     *  获取所有合同编号
     * @return
     */
    @Select("SELECT contract_number FROM con_resource_main")
    List<String> getAllContractNumbers();

    /**
     * 根据合同编号查询合同名称
     * @param mainContract
     * @return
     */
    @Select("SELECT contract_name FROM con_resource_main WHERE id = #{mainContract}")
    String getNameById(Long mainContract);
}
